class Animals():
    def eat(self):
        print("吃饭")
        pass
    def drink(self):
        print("喝水")
        pass
class Cat(Animals):
    def miaomiao(self):
        print("喵喵")
        pass
class Dog(Animals):
    def wangwang(self):
        print("汪汪")
        pass
dewen=Cat()
dewen.eat()
hashiqi=Dog()
hashiqi.drink()

class A():
    def a(self):
        print("我是方法a")
        pass
class B():
    def b(self):
        print("我是方法b")
class C(A,B):
    pass
c=C()
c.a()
c.b()

#################父类同名方法调用顺序###############################
class Base1():
    def test(self):
        print("我是Base1中的test方法")
        pass
class Base2():
    def test(self):
        print("我是Base2中的test方法")
        pass
class D(Base1):
    # def test(self):
    #     print("我是D中的test方法")
    #     pass
    pass
class E(Base2):
    def test(self):
        print("我是E中的test方法")
        pass
class F(D,E):
    # def test(self):
    #     print("我是F中的test方法")
    #     pass
    pass

f=F()
f.test()
print(F.__mro__)
# 方法的重写
class Father():
    def drink(self):
        print("我会喝白酒")
        print("我会喝啤酒")
        pass
class Son(Father):
    def drink(self):
        # 可以通过super或父类名字调用父类的方法，但是二者只出现一个即可
        # super().drink()
        Father.drink(self)
        print("我会喝红酒")
        pass
s=Son()
s.drink()